package com.heitian.ssm.controller;

import com.heitian.ssm.model.AddressList;
import com.heitian.ssm.model.Limit;
import com.heitian.ssm.service.AddressListService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/softPhone")
public class SoftPhoneController {
    private Logger log = Logger.getLogger(SoftPhoneController.class);

    @Resource
    private AddressListService addressListService;

    @RequestMapping("/toLogin.do")
    public ModelAndView toLogin(HttpServletRequest request, HttpSession session){
        //log.info("查询所有用户信息");

        ModelAndView mv = new ModelAndView();
        mv.setViewName("softPhone/login");
        return mv;
    }
    @RequestMapping("/login.do")
    public ModelAndView index(HttpServletRequest request, HttpSession session){
        //log.info("查询所有用户信息");

        String loginId = request.getParameter("loginId");
        String place = request.getParameter("place");

        List<AddressList> list = addressListService.selectAllAddressList("");

        ModelAndView mv = new ModelAndView();
        mv.setViewName("softPhone/index");
        mv.addObject("loginId",loginId);
        mv.addObject("place",place);
        mv.addObject("list",list);
        return mv;
    }
}
